package com.design.StateMode.simpleDemo;

/**
 * @Description: 黄灯状态处理
 * @Author: LiHaiChao
 * @Date: 2022/1/13 13:57:16
 * @Version: 1.0
 */
public class YellowState implements State{

    public static final String YELLOW_LAMP = "yellow";

    private String lamp;

    public YellowState(String lamp) {
        this.lamp = lamp;
    }

    @Override
    public void handler() {
        if(lamp.equals(YELLOW_LAMP)){
            System.out.println("当前黄灯 -> 减速!");
        }else{
            System.out.println("错误状态");
        }
    }
}
